﻿@using CodeCamp.Models.Presenters
@using CodeCamp.Models.Shared
@model PresentersDetailsViewModel
@{
    @* ViewBag.RegistrationUrl set in code - SetSharedViewBagProperties *@
    ViewBag.Title = "";
    if ((@Model != null) && (@Model.EventDisplayName != null))
    {
        ViewBag.Title = @Html.Encode(@Model.EventDisplayName + " | Presenter profile for " + @Model.Name);
    }
    else
    {
        ViewBag.Title = "Code Camp | Session Details for " + @Html.Encode(@Model.Name);
    }
}

@section headaddon {
<style>
    p.presenter-bio
    {
        margin-top: 8px;
    }
    div.presenter-edit-links
    {
        margin: 10px 0 10px 0;
    }
    h3.title
    {
        margin-bottom: 10px;
    }
    div.presenter-bio
    {
        margin-top: 10px;
    }
    h3.presenter-sessions
    {
        margin-top: 10px;
    }
    span.presenter-name
    {
        font-size: 20px;
    }
    table
    {
        border-collapse: collapse;
        border: solid 1px;
        margin: 0;
    }
    th
    {
        padding: 4px;
    }
    td 
    {
        padding: 4px;
    }
</style>
}

@{
    bool prevLink = false;
    <div class="presenter-edit-links">
    @if (User.Identity.IsAuthenticated &&  @Model.CurrentUserAuthorizedToEdit)
    {
        @Html.ActionLink("Edit", "Edit", new { id = Model.PresenterId })
        prevLink = true;
        if (Model.MembershipEnabled && User.IsInRole(CCRoles.RoleNames.Presenter))
        {
            <text>|&nbsp;</text>@Html.ActionLink("Change Password", "ChangePassword", "Account", new { eventName = Model.EventShortName }, null) <text>(of logged in user @User.Identity.Name)</text>
            prevLink = true;
        }
    }
    @if (User.Identity.IsAuthenticated && User.IsInRole(CCRoles.RoleNames.BigCheeze) && Model.PresenterSiteUserId.HasValue)
    {
        if (prevLink)
        {
            <text>|&nbsp;</text>
        }
        @Html.ActionLink("Site User Detail", "SiteUserDetail", "EventMgmt", new { eventName=Model.EventShortName, id=Model.PresenterSiteUserId.Value }, null)
    }
    </div>
}

<h3 class="title">Presenter Profile for</h3>

@Html.Partial("PresenterHeader", Model)

<div class="presenter-bio">
@Model.Biography
</div>
@if (Model.UserIsNewPresenter && !User.IsInRole(CCRoles.RoleNames.BigCheeze) && !User.IsInRole(CCRoles.RoleNames.EventContentEditor))
{
    <h3>Sign out and sign in again to edit profile or add/edit session(s).</h3>
}
<h3 class="presenter-sessions">Sessions</h3>
<ul>
@foreach (var session in Model.Sessions)
{
    <li class="presenterSession">@Html.ActionLink(session.Title, "Details", "Sessions", new { id = @session.SessionId }, null)</li>
}
</ul>

@if ((Model.PrivateInfo != null) && (User.IsInRole(CCRoles.RoleNames.BigCheeze) || User.IsInRole(CCRoles.RoleNames.EventTrackLead)))
{
    <div>
        <h2>Private Information</h2>
        <h3>Do not share this information in public</h3>
        Email: @Model.PrivateInfo.PresenterEmailAddress<br />
        Mobile Phone: @Model.PrivateInfo.PresenterMobilePhone<br />
        @if (!string.IsNullOrWhiteSpace(Model.PrivateInfo.PrivateNotes))
        {
            <text>Presenter Private Notes (shared with organizers):<br /></text>
            @Html.TextAreaFor(model => model.PrivateInfo.PrivateNotes, new { cols = 60, rows = 5, @readonly = "true" })<br />
        }
        @if (!string.IsNullOrWhiteSpace(Model.PrivateInfo.OrganizerNotes))
        {
            <text>Organizer Notes (not visible to presenter):<br /></text>
            @Html.TextAreaFor(model => model.PrivateInfo.OrganizerNotes, new { cols = 60, rows = 5, @readonly = "true" })<br />
        }
        @if (Model.PrivateInfo.LastActivity.HasValue)
        {
            <text>Last Activity: </text>@string.Format("{0:yyyy-MM-dd  HH:mm}", Model.PrivateInfo.LastActivity)<text> @Model.PrivateInfo.LastActivitySuffix</text>
        }
    </div>
}

@if (Model.InsiderFormInfo != null)
{
    <br />
    @Html.Partial("PresenterDetailsInsiderFormPartial", Model.InsiderFormInfo)
}

@if (Model.EmailList != null)
{
    @Html.Partial("Partial/EmailItemsShortListPartial", Model.EmailList)
}

@if (Model.GetType() == typeof(PresentersDetailsViewModelAdvanced) && User.IsInRole(CCRoles.RoleNames.BigCheeze))
{
    <div id="extendedProperties">
        @Html.Partial("AdvancedDetailPartial", @Model as PresentersDetailsViewModelAdvanced)
    </div>
}

@section sidebar {
    @Html.Partial("SidebarCommonPartial")
}
